package nl.utwente.csc.obsl.diagram.extension.part;

import nl.utwente.csc.obsl.diagram.extension.figure.RelatorFigure;

import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.XYLayout;
import org.eclipse.gef.DragTracker;
import org.eclipse.gef.Request;
import org.eclipse.gmf.runtime.gef.ui.figures.NodeFigure;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.sirius.diagram.ui.edit.api.part.AbstractNotSelectableShapeNodeEditPart;
import org.eclipse.sirius.diagram.ui.edit.api.part.IStyleEditPart;
import org.eclipse.sirius.diagram.ui.tools.api.figure.AirStyleDefaultSizeNodeFigure;
import org.eclipse.sirius.ui.tools.api.color.VisualBindingManager;

public class RelatorShapeEditPart extends AbstractNotSelectableShapeNodeEditPart implements IStyleEditPart{

protected IFigure primaryShape;

public RelatorShapeEditPart(View view) {
	super(view);
}

public DragTracker getDragTracker(Request request) {
	return getParent().getDragTracker(request);
}

protected void createDefaultEditPolicies() {
}

public IFigure getContentPane() {
	if (primaryShape != null) {
		return primaryShape;
	}
	return super.getContentPane();
}

protected NodeFigure createNodeFigure() {
	NodeFigure figure = new AirStyleDefaultSizeNodeFigure(getMapMode()
			.DPtoLP(120), getMapMode().DPtoLP(40));
	figure.setLayoutManager(new XYLayout());
	IFigure shape = new RelatorFigure();
	shape.setBackgroundColor(VisualBindingManager.getDefault().getColorFromName("light_purple"));
	shape.setForegroundColor(VisualBindingManager.getDefault().getColorFromName("black"));
	figure.add(shape);
	primaryShape = figure;
	return figure;
}
}


